import { getUserInfo } from "."
import request from "./request"

export const login = (data) => {
  return request({url: '/clientLogin/login', data})
}


export const getInfo  = (data) => {
  return request({url: '/clientLogin/getUserByToken', data})
}
export const updateInfo  = (data) => {
  return request({url: '/user/InsertOrUpdateUser', data})
}

export const getDeptList = () => {
  return request({isLoading: false, url: '/dept/getDeptList', data: {page: 1, pageSize: 100000}})
}

export const getAuditList = (data) => {
  const info = getUserInfo()
  return request({isLoading: false,url: '/audit/getAuditDataList', data: {...data,userId: info.userId }})
}

export const getAuditDetail = (data) => {
  return request({url: '/audit/getAuditDataInfoById/' + data.auditId, data})
}

export const getStuffList = () => {
  return request({isLoading: false, url: '/user/getUserList', data: {page: 1, pageSize: 100000}})
}

export const getSignList = (data) => {
  const info = getUserInfo()
  return request({url: `/clock/getUserClockInfoByMonth/${data.month}/${info.userId}`, data})
}

export const getAllMonth = () => {
  return request({url: '/clock/getClockCustomConfigListMonth', data: {page: 1, pageSize: 1000000}})
}

export const getDetailByDay = (data) => {
  const info = getUserInfo()
  return request({url: `/clock/getUserClockInfoByDay/${data.day}/${info.userId}`, data})
}


export const applyAudit = (data) => {
  const info = getUserInfo()
  return request({url: `/audit/insertAuditInfo`, data: {...data,userId:info.userId }})
}


export const getClockConfig = (data) => {
  return request({url: `/clock/getClockConfigInfo`, data})
}

export const updateAuditInfo = (data) => {
  return request({url: `/audit/updateAuditInfo`, data})
}


// 1 上班 2 下班
export const setClockIn = data => {
  const info = getUserInfo()
  return request({url: `/clock/userClockIn/${data.clockType}`, data : {...data, userId:info.userId}})
}

export const getCommentList = data => {
  const info = getUserInfo()
  return request({url: '/evaluate/getEmployeeEvaluateList', data: {...data, userId: info.userId}})
}

export const log = data => {
  return request({url: '/clock/insertClockLog', data})
}

export const endOverTime = data => {
  return request({url: '/audit/overTimeByRealEnd', data})
}